package com.yanqu.road.server.manager.activity.chuhan.task.impl;

import com.yanqu.road.entity.enums.eTongBingTaskType;
import com.yanqu.road.server.manager.activity.chuhan.activity.CrossChuHanActivity;
import com.yanqu.road.server.manager.activity.chuhan.task.BaseCrossChuHanTask;
import com.yanqu.road.utils.date.DateHelper;

public class CrossChuHanRefreshOrderCityTask extends BaseCrossChuHanTask {

    public CrossChuHanRefreshOrderCityTask(CrossChuHanActivity activity, long beginTime) {
        super(activity, beginTime);
    }

    @Override
    public void runTask() {
        activity.refreshOrderCity();

        //每次检查后等下一天0点再检查
        if (DateHelper.getCurrentTime()/1000 < activity.getConfig().getActivityInfo().getEndTime()) {//活动结束了就不要跑任务了
            long nextCheckTime = DateHelper.getTodayZeroTimeStamp() + DateHelper.DAY_MILLIONS;
            activity.addTask(new CrossChuHanRefreshOrderCityTask(activity, nextCheckTime));
        }
    }

    @Override
    public String getId() {
        return generateId();
    }

    @Override
    public eTongBingTaskType getType() {
        return eTongBingTaskType.CityEventRefresh;
    }

    public static String generateId() {
        return "";
    }
}
